import { defHttp } from "@/utils/http";

// ERP 经费记录 VO
export interface ExpenseRecordsVO {
	id: number; // 主键
	parentId: number; // 父级Id
	feeDate: Date; // 年份
	groupId: number; // 二级组别ID
	amount: number; // 金额
	usedAmount: number; // 已使用金额
	reportId: number; // 报告编号
}

// ERP 经费记录 API
export const ExpenseRecordsApi = {
	// 查询经费记录分页
	getExpenseRecordsPage: async (params: any) => {
		return await defHttp.get({ url: `/whs/admin-fees/page`, params });
	},

	// 查询经费记录详情
	getExpenseRecords: async (id: number) => {
		return await defHttp.get({ url: `/whs/admin-fees/get?id=` + id });
	},

	// 新增经费记录
	createExpenseRecords: async (data: ExpenseRecordsVO) => {
		return await defHttp.post({ url: `/whs/admin-fees/create`, data });
	},

	// 修改经费记录
	updateExpenseRecords: async (data: ExpenseRecordsVO) => {
		return await defHttp.put({ url: `/whs/admin-fees/update`, data });
	},

	// 删除经费记录
	deleteExpenseRecords: async (id: number) => {
		return await defHttp.delete({
			url: `/whs/admin-fees/delete?id=` + id
		});
	},

	// 导出经费记录 Excel
	exportExpenseRecords: async (params: any) => {
		return await defHttp.download({ url: `/whs/admin-fees/export-excel`, params });
	}
};
